package com.bawei.park2211a.adapter

import android.graphics.Color
import android.widget.LinearLayout
import android.widget.TextView
import com.bawei.park2211a.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class VisitTypeAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_visittype) {
    var visitType = "全部状态"
    override fun convert(helper: BaseViewHolder, item: String) {
        helper.setText(R.id.visit_type, item)
        val view = helper.getView<LinearLayout>(R.id.visit_lin)
        if (visitType == item) {
            view.setBackgroundResource(R.drawable.text_color2)
            helper.setTextColor(R.id.visit_type, Color.BLUE)
        } else {
            view.setBackgroundResource(R.drawable.text_color5)
            helper.setTextColor(R.id.visit_type, Color.WHITE)
        }
    }

    fun setTypeId(type: String, startindex: Int, endIndx: Int) {
        visitType = type
        notifyItemChanged(startindex)
        notifyItemChanged(endIndx)
    }
}